<h1>Manage Forms</h1>

<style type="text/css">
.grid-view .button-column {width: 90px;}
</style>
<?php $grid = $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'form-grid',
    'dataProvider'=>$model->search(),
    'columns'=>array(
        array(
            'class'=>'CCheckBoxColumn',
            'value'=>'$data->id',
            'htmlOptions'=>array('width'=>'3%'),
        ),
        'id',
        array(
            'name'=>'name',
            'type'=>'html',
            'value'=>'CHtml::link($data->name, array("/Cms/admin/widget/editForm", "id"=>$data->id), array("title"=>"Edit ".$data->name))',
        ),
        'description',
        array(
            'name'=>'status',
            'type'=>'raw',
            'value'=>'CHtml::link($data->statusText, "#", array("class"=>($data->status ? "active" : "")))',
            'filter'=>false,
            'htmlOptions'=>array(
                'class'=>'status-column'
            )
        ),
        array(
            'name'=>'creation_datetime',
            'value'=>'Yii::app()->getDateFormatter()->formatDateTime(strtotime($data->creation_datetime))',
            'filter'=>false,
            'htmlOptions'=>array('class'=>'datetime-column'),
        ),
        array(
            'name'=>'last_update',
            'value'=>'Yii::app()->getDateFormatter()->formatDateTime(strtotime($data->last_update))',
            'filter'=>false,
            'htmlOptions'=>array('class'=>'datetime-column'),
        ),
        array(
            'class'=>'CButtonColumn',
            'template'=>'{delete} {update} {view} {csv}',
            'deleteConfirmation'=>"js:'All data user submitted will be deleted. Click No to stop this action and export the data first.\\nClick Yes to delete the form and all associated data.'",
            'updateButtonUrl'=>'Yii::app()->controller->createUrl("/Cms/admin/widget/editForm", array("id"=>$data->id))',
            'viewButtonUrl'=>'Yii::app()->controller->createUrl("/Cms/admin/widget/formData", array("id"=>$data->id, "layout"=>"popup"))',
            'viewButtonOptions'=>array(
                'class'=>'view-form-data',
            ),
            'deleteButtonUrl'=>'Yii::app()->controller->createUrl("/Cms/admin/widget/deleteForm", array("id"=>$data->id))',
            'buttons'=>array(
                'csv'=>array(
                    'label'=>'Export CSV',
                    'imageUrl'=>'/themes/Admin/images/export-csv.png',
                    'url'=>'Yii::app()->controller->createUrl("/Cms/admin/widget/formExport", array("id"=>$data->id))',
                    'options'=>array(
                        'title'=>'Export CSV',
                        'target'=>'_blank',
                    )
                )
            )
        ),
    ),
));
?> 